<template>
  <div>
    <button @click="getRoot">GetRoot</button>
  </div>
</template>

<script>
export default {
  methods: {
    getRoot() {
      console.log(this.$root);

      var parent = this.$parent;
      while (parent.$parent) {
        parent = parent.$parent;
      }
      console.log(parent);
    }
  }
};
</script>

<style>
</style>